package com.example.helloworld;

import java.util.LinkedList;

public class LinkedTest {
    public static void main(String[] args) {
        LinkedList<String> sites = new LinkedList<String>();
        sites.add("Google");
        sites.add("Facebook");
        sites.add("Yahoo");
        System.out.println(sites);
        sites.addFirst("baidu");
        System.out.println(sites);
        sites.addLast("Bing");
        System.out.println(sites);
        sites.removeFirst();
        System.out.println(sites);
        sites.removeLast();
        System.out.println(sites);
        System.out.println(sites.getFirst());
        System.out.println(sites.getLast());
        for (int i = 0; i < sites.size(); i++) {
            System.out.println(sites.get(i));
        }
        System.out.println("-----");
        for (String site : sites) {
            System.out.println(site);
        }
    }
}
